package com.hejia.alauda.service;

import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;
import com.hejia.cas.security.Member;

@Service
public class AccountServiceImpl implements AccountService {

	@Override
	public Member getCurrentAccount() {

		Authentication authentication = SecurityContextHolder.getContext()
				.getAuthentication();
		Object principal = authentication.getPrincipal();
		if (principal instanceof Member) {
			return (Member) principal;
		}
		return null;
	}
}
